/*!
\copyright  Copyright (c) 2024 Qualcomm Technologies International, Ltd.
            All Rights Reserved.
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\file
\brief      Implementation of Audio Curation application testing functions

*/
#ifndef HEADSET_TEST_AUDIO_CURATION_H
#define HEADSET_TEST_AUDIO_CURATION_H

#include <stdio.h>
#include <stdlib.h>
#include "types.h"
#include "source_param_types.h"

/*!
    \brief Enable ANC with default mode configuration
*/
void HeadsetTestAudioCuration_SetAncEnable(void);

/*!
    \brief Disable ANC , stop current active mode
*/
void HeadsetTestAudioCuration_SetAncDisable(void);

/*!
    \brief Set Mode to requested mode

    \param req_mode requested mode
*/
void HeadsetTestAudioCuration_SetMode(uint8 req_mode);

/*!
    \brief Start Tuninng Mode

    \param mode tuning mode to start tuning for specified mode
*/
void HeadsetTestAudioCuration_EnterTuning(uint8 mode);

void HeadsetTestAudioCuration_WriteFilter(void);

/*!
    \brief Stop Tuning Mode
*/
void HeadsetTestAudioCuration_ExitTuning(void);

/*!
    \brief Set toggle config: enable/disable a specific mode in a range of toggle indices

    \param toggle_index Index at which mentioned mode to be enabled
    \param mode Mode for which toogle is to be enabled. If invalid mode (0xFF)
                is send, then toggle option will be disabled at that index
 */

void HeadsetTestAudioCuration_SetToggleConfig(uint8 toggle_index, uint8 mode);

/*!
    \brief Toggle enable/disable - If ANC is disabled then enable ANC with last mode or default mode
    (whichever is applicable). If ANC is enabled then disable ANC
 */
void HeadsetTestAudioCuration_ToggleAnc(void);

/*!
    \brief Switch to next objective which has toggle support
*/
void HeadsetTestAudioCuration_ToggleWay(void);

/*!
    \brief Update concurrency config for an active source. configs that can be updated for a
    particular source are requested mode and enable toggle

    \param active_source source (source_type_voice or source_type_audio) whose concurrency is to be set
    \param mode requested mode to be set for source
    \param enable_toggle to enable/disable toggle for source

*/
void HeadsetTestAudioCuration_SetConcurrencyConfig(source_type_t active_source, uint8 mode, bool enable_toggle);

/*!
    \brief Return current active mode
*/
uint8 HeadsetTestAudioCuration_GetCurrentMode(void);

/*!
    \brief Get current active context state
     Currently the supported states are:
     anc_disabled         : 0
     anc_enabled          : 1
     tuning_mode_active   : 2
*/
audio_curation_provider_context_t HeadsetTestAudioCuration_GetContextState(void);

/*!
    brief Return total number of modes available
*/
uint8 HeadsetTestAudioCuration_GetNumModes(void);

/*!
    brief Enable/Disable tuning
*/
bool HeadsetTestAudioCuration_EnableTuning(bool enable);

/*!
    brief PSAP Volume Up
*/
void HeadsetTestAudioCuration_PsapVolumeUp(void);

/*!
    brief PSAP Volume Down
*/
void HeadsetTestAudioCuration_PsapVolumeDown(void);

/*!
    brief Set world volume in dB for given objective.
    API is expected to work only for transparency/psap use case.
*/
void HeadsetTestAudioCuration_SetWorldVolume(uint8 obj, int16_t volume);

/*!
    brief Enable/Disable HA feature enable/disable
    Hearing assistance features listrefer ha_feature_t
 */
void HeadsetTestAudioCuration_HaFeatureEnable(uint32_t feature, bool enable);

/*!
    Toggle adaptivity in ANC. If static ANC is active and api is called
    it would start adaptive anc and if adaptive anc is active and api is called
    then it would become static ANC.
*/
void HeadsetTestAudioCuration_ToggleAncAdaptivity(void);

/*!
    brief Set prescription audiogram to the required value.
*/
void HeadsetTestAudioCuration_SetAudiogram(uint8_t audiogram);

/*!
    \brief Set volume for left and right devices with given objective. e.g. Transparency or PSAP 
    \param obj Objective whose volume is to be set
    \param lvolume desired volume for left device
    \param rvolume desired volume for right device
*/
void HeadsetTestAudioCuration_SetVolume(uint8 obj, int16_t lvolume, int16_t rvolume);

/*! \brief Set (enable/disable) feature in monitor.

    \param fid_mask feature id bit mask to enable feature refer monitor_feature_t.
    \return TRUE if monitor feature is set otherwise FALSE.
*/
bool HeadsetTestAudioCuration_SetMonitorFeature(uint32 fid_mask);

/*! \brief Set Equalizer gain for ambient.
    \param obj objective mode.
    \param gain_level Eqalizer gain index.
    \param peer_sync TRUE gain is sent to local and remote, FALSE only local.
    \return none.
*/
void HeadsetTestAudioCuration_SetEqGain(uint8 obj, int16_t gain_level, bool peer_sync);

/*  \brief Starts Audio curation Hearing Test use case.
    \param hearing_test hearing_test index.

    \return TRUE if hearing test use case starts otherwise FALSE.
*/
void HeadsetTestAudioCuration_HearingTestStart(uint32_t channel, uint32_t frequency, int32_t loudness);

/*  \brief Stops Audio curation Hearing Test use case.

    \return TRUE if Hearing Test use case stops otherwise FALSE.
*/
void HeadsetTestAudioCuration_HearingTestStop(uint32_t channel);

/*  \brief Start tone play for which user can hear.
    \param channel 0 (left), 1 (right)
    \param frequency Frequency (Hz)
    \param loudness Tone volume (dB HL or dB SPL)

    \return none
*/
void HeadsetTestAudioCuration_HearingTestPlayTone(uint32_t channel, uint32_t frequency, int32_t loudness);

/*  \brief Stop tone play.
    \param channel 0 (left), 1 (right)

    \return none
*/
void HeadsetTestAudioCuration_HearingTestStopTone(uint32_t channel);

/*  \brief Store user defined audiogram for agiven hearing index for which user hears tone.
    \param hearing_test hearing_test index.
    \param channel 0: left, 1: right
    \param audiogram_size audiogram payload in bytes
    \param audiogram_config audiogram payload

    \return none
*/
void HeadsetTestAudioCuration_HearingTestStoreResult(uint32_t hearing_test, uint32_t channel, uint32_t audiogram_size, uint32_t audiogram_config[]);

/*! \brief Get mode change status

    \return  return 1 if mode change is completed else return 0.
*/
uint32_t HeadsetTestAudioCuration_GetModeChangeStatus(void);

/*  \brief Set adaptive gain for adaptive audio configuration.
    \param anc_gain adaptive anc gain in percentage
    \param transparency_gain adaptive ambient gain in percentage
    \param blend_time_ms blending duration in microseconds(ms)
    \return none
*/
void HeadsetTestAudioCuration_SetAdaptiveAudioTransparency(uint32_t anc_gain, uint32_t ambient_gain, uint32_t blend_time_ms);

/*  \brief Set adaptive gain for adaptive audio configuration.
    \param anc_gain adaptive anc gain in percentage
    \param psap_gain adaptive psap gain in Q31
    \param blend_time_ms blending duration in microseconds(ms)

    \return none
*/
void HeadsetTestAudioCuration_SetAdaptiveAudioPsap(uint32_t anc_gain, uint32_t  psap_gain, uint32 blend_time_ms);


#endif /* HEADSET_TEST_AUDIO_CURATION_H */

